import { PayloadUser } from '@libs/common/decorator';
import { IndexInterceptor } from '@libs/common/interceptors';
import { Body, Controller, Post, UseInterceptors } from '@nestjs/common';

import {
  IndexOvertimeApplyDto,
  ShowOvertimeApplyDto,
} from './dto/overtime-apply.dto';
import { OvertimeApplyService } from './overtime-apply.service';

@Controller('hr/overtime-apply')
export class OvertimeApplyController {
  constructor(private readonly overtimeApplyService: OvertimeApplyService) {}

  @Post('index')
  @UseInterceptors(new IndexInterceptor())
  index(@Body() dto: IndexOvertimeApplyDto) {
    return this.overtimeApplyService.index(dto);
  }

  @Post('show')
  show(@Body() dto: ShowOvertimeApplyDto) {
    return this.overtimeApplyService.show(dto);
  }

  @Post('count')
  count(@PayloadUser() user: SC.User.Info) {
    return this.overtimeApplyService.userCount(user);
  }
}
